closeWindow = function () {
    parent.layer.close(parent.layer.getFrameIndex(window.name));
};

submitSures = function () {
    var referralerPersoned = $("#newDoctors").html(); //被转诊人
    var customerId = $("#customerId").val();
    var reservationsId = $("#reservationsId").val();
    var referralerPerson = $("#referralerPerson").val();//转诊人
    var remarks = $("#remarkss").val();
    if(referralerPersoned==null || referralerPersoned==""){
        alert("请选择转诊医生");
        return;
    }
    if(remarks==null || remarks==""){
        alert("请添加备注");
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/doctorLooked/referralerPerson",
        type: "post",
        data:{
            referralerPersoned:referralerPersoned,
            customerId:customerId,
            referralerPerson:referralerPerson,
            remarks:remarks
        },
        success: function (data) {
                Feng.success('操作成功!');
                window.parent.DoctorLooked.search();
                $('#cancel').click();
        },
        error: function (data) {
            alert('没有权限，请联系管理员!');
        }
    });
};

$(function () {
    $.ajax({
        url: Feng.ctxPath + "/consultant/getDoctor",
        type: "get",
        success: function (data) {
            var txt = '';
            for (var i = 0; i < data.length; i++) {
                txt += '<span>' + data[i].doctor + '</span>';
            }
            document.getElementById('doctorBox').innerHTML = txt;
        },
        error: function (data) {
            alert('没有权限，请联系管理员!');
        }
    });
    $("#doctorBox").on('click','span',function () {
        $("#newDoctors").html($(this).text());
        $(this).addClass('selectionSpan').siblings().removeClass('selectionSpan')
    });
});